 
 
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>共享睡眠仓管理后台</title>
<link rel="stylesheet" href="css/layui.css">
</head>
<body class="layui-layout-body">
<div class="layui-layout">
  <div class="layui-side layui-bg-black">
    <div class="layui-side-scroll">
      <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
      <ul class="layui-nav layui-nav-tree"  lay-filter="left-nav" id="leftnav">
        <li class="layui-nav-item layui-nav-itemed navIlist">
          <a class="parentnav" href="javascript:;" >所有商品</a>
          <dl class="layui-nav-child">
            <dd><a href="javascript:;" >列表一</a></dd>
          </dl>
        </li>
      </ul>
    </div>
  </div>
  
  <div class="layui-body" style="padding:20px;">
    <!-- 内容主体区域 -->
     <iframe id="iframe" MARGINWIDTH=0 MARGINHEIGHT=0 HSPACE=0 VSPACE=0 FRAMEBORDER=0 SCROLLING=no src="home.html" height="100%" width="100%"></iframe>
  </div>
</div>
<script src="layui.js"></script>
<script>

//JavaScript代码区域
layui.use(['element','jquery'], function(){
  var element = layui.element;
  var $=layui.jquery;
  var navs=[
                {id: 1, node: '首页', url: 'home.html'},
                {id: 2, node: '框架', url: 'list.html'},
                {id: 3, node: '财务管理', url: 'list.html',submenu:[ 
                {id: 3, node: '押金设置', url: 'list.html'},
                {id: 4, node: '押金管理', url: 'list.html'},
                ]},
            ];
  var nav=$("#leftnav");
  var list=nav.find(".navIlist");
  nav.empty();
  for(var i=0;i<navs.length;i++){
    var clist=list.clone();
    clist.find('.parentnav').attr('url',navs[i].url);
    clist.find('.parentnav').text(navs[i].node);
    clist.find('.parentnav').click('click',function(){
      var url=$(this).attr('url');
      $('#iframe').attr('src',url);
    });
    var dl=clist.find('dl');
    var dd=dl.find('dd');
    dl.empty();
    if(navs[i].submenu){
       for(var j=0;j<navs[i].submenu.length;j++){
        var cdd=dd.clone();
        cdd.find('a').attr('url',navs[i].submenu[j].url);
        cdd.find('a').text(navs[i].submenu[j].node);
        cdd.find('a').click('click',function(){
          var url=$(this).attr('url');
          $('#iframe').attr('src',url);
        });
        dl.append(cdd);
      }
    }
    nav.append(clist);
  }
});
</script>
</body>
</html>
